import QtQuick 1.0
import com.nokia.symbian 1.0
import "../js/Storage.js" as Storage

Item {
    id: sessionOpenTimeListItem

    width:  sessionOpenTimeListItem.ListView.view.width
    height: 130

   Column {
       FontLoader {
           id: fontStyle
           name: "Helvetica"
       }

       Rectangle {
           id: sessionOpenTimeListRect

           width:  sessionOpenTimeListItem.width
           height: sessionOpenTimeListItem.height
           color:  "#ffffff"
           border.width: 1
           border.color: "black"
           smooth: true

           Text {
               id: sessionName
               anchors.top: parent.top
               anchors.topMargin: 2
               width: parent.width

               text: name
               color:  "black"
               font.family: fontStyle.name
               font.bold: true
               //font.pointSize: 8
               font.pixelSize: 20

               wrapMode: Text.WordWrap

           }

           Text {
               id: sessionSpeaker

               anchors.top: sessionName.bottom
               anchors.topMargin: 8

               text: speaker
               color: "black"
               font.family: fontStyle.name
               font.pixelSize: 18

               wrapMode: Text.WordWrap
           }

           Text {
               id: sessionRoom

               anchors.bottom: parent.bottom
               anchors.bottomMargin: 2

               text: room
               color: "blue"
               font.family: fontStyle.name
               font.pixelSize: 17

               wrapMode: Text.WordWrap

           }

           FavoriteItem {
               id: sessionFavorite

               z: 1

               anchors.bottom: parent.bottom
               anchors.right: parent.right

               state: starIcon



               MouseArea {
                   anchors.fill: parent

                   onClicked: {
                       if (sessionFavorite.state == "select") {
                           sessionFavorite.state = "un-select";
                           Storage.setFavoriteCache(sessionId.text, 0);
                       } else {
                           sessionFavorite.state = "select"
                           Storage.setFavoriteCache(sessionId.text, 1);
                       }

                    }
               }

           }

           Text {
               id: sessionIsBreak

               text: isBreak
               color: "black"
               visible:  false
           }

           Text {
               id: sessionId

               text: id
               color: "black"
               visible: false
           }


           MouseArea {
               id: sessionOpenListMouse
               anchors.fill: parent

               onClicked: {
                   if (sessionIsBreak.text != "true") {
                       sessionOpenDetail.sessionDetail(sessionId.text)
                       pageStack.push(sessionOpenDetail);
                   }
               }

               onPressed: {
                   parent.color = "#c5e9c4"
               }

               onReleased: {
                   parent.color = "#ffffff"
               }

               onCanceled: {
                   parent.color = "#ffffff"
               }
           }
       }
   }

}
